﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace AxeFrog.Data
{
	public interface IRepository
	{
		object GetById(object id);
		List<object> ListById(IEnumerable ids);
		void Store(object entity);
		void Delete(object id);
		int Count();
	}

	public interface IRepository<TEntity, TID> : IRepository
		where TEntity : IIdentifiable<TID>
	{
		TEntity Get(Expression<Func<TEntity, bool>> expr);
		TEntity GetById(TID id);
		List<TEntity> ListById(IEnumerable<TID> ids);
		List<TEntity> List();
		List<TEntity> List(Expression<Func<TEntity, bool>> expr);
		void Store(TEntity entity);
		void Store(IEnumerable<TEntity> entities);
		void Delete(TID id);
		void Delete(Expression<Func<TEntity, bool>> expr);
		int Count(Expression<Func<TEntity, bool>> expr);
	}
}
